<!DOCTYPE html>
<title>Service Worker: force-refresh registration test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js"></script>
<body>
<script>

async_test(function(t) {
    var scope = 'resources/force-refresh-register';
    with_iframe('resources/blank.html')
      .then(t.step_func(function(frame) {
          var p = new Promise(function(resolve) {
              // Override onload handler assigned by with_iframe.
              frame.onload = t.step_func(function() {
                  resolve(frame.contentWindow.navigator.serviceWorker.register(
                      'empty-worker.js',
                      {scope: scope}));
              });
          });
          frame.contentWindow.internals.forceReload(true);
          return p;
        }))
      .then(t.step_func(function() {
          service_worker_unregister_and_done(t, scope);
        }))
      .catch(unreached_rejection(t));
  }, 'Registering script from force-refreshed frame');

</script>
